package test.generic;

/**
 * Created by linshuo on 2017/12/21.
 * <p>
 * 泛型的缺陷
 */

class Girl {
    public void speak() {
        System.out.println("I am a girl~");
    }
}

class DoSpeech<T> {
    public void startSpeech(T human) {
        // human.speak(); // 换成C++这一句是不会报错的; Java泛型擦除导致无法获取T里面的方法
    }
}

public class GenericFlaw {
    public static void main(String[] args) {
        DoSpeech speech = new DoSpeech<Girl>();
        speech.startSpeech(new Girl());
    }
}
